package com.zzzyh.blogbyspring.service;

import com.zzzyh.blogbyspring.controller.Blog;
import com.zzzyh.blogbyspring.mapper.BlogMapper;
import com.zzzyh.blogbyspring.pojo.BlogInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BlogService {

    @Autowired
    private BlogMapper blogMapper;

    public Integer getUidByBlogId(Integer blogId) {
        return blogMapper.getUidByBlogId(blogId);
    }

    public List<BlogInfo> getBlogList() {
        return blogMapper.getBlogInfoList();
    }

    public BlogInfo getBlogInfoById(Integer id) {
        return blogMapper.getBlogInfoById(id);
    }

    public Boolean addBlogInfo(BlogInfo blogInfo) {
        return blogMapper.addBlogInfo(blogInfo) > 0;
    }

    public Boolean deleteBlogInfo(Integer id) {
        return blogMapper.deleteBlogInfo(id) > 0;
    }

    public Boolean updateBlogInfo(BlogInfo blogInfo) {
        return blogMapper.updateBlogInfo(blogInfo) >0;
    }
}
